package com.changgou.goods.dao;

import com.changgou.goods.pojo.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface BrandMapper extends Mapper<Brand> {
    @Select("SELECT * FROM tb_brand WHERE tb_brand.id IN(SELECT tb_category_brand.brand_id FROM tb_category_brand WHERE tb_category_brand.category_id IN(SELECT tb_category.id FROM tb_category where tb_category.`name`='手机'))")
    public List<Brand> selectBrandByCategoryName(@Param("categoryName")String categoryName);
    @Select("SELECT tb_spec.`name`,tb_spec.`options` FROM tb_spec WHERE tb_spec.template_id IN (SELECT tb_category.template_id FROM tb_category where tb_category.`name`='手机')")
    public List<Map> selectSpecByCategoryName(@Param("categoryName")String categoryName);
}
